﻿using Business.Logic;
using Newtonsoft.Json;
namespace GogTasks.Entities
{
    public class JsonApi : IJsonApi
    {
        #region IJsonApi Members
        public T Deserialize<T>(string json)
        {
            var jsonSettins = new JsonSerializerSettings();
            jsonSettins.MissingMemberHandling = MissingMemberHandling.Ignore;
            return JsonConvert.DeserializeObject<T>(json, jsonSettins);
        }

        public string Serialize(object o)
        {
            var settings = new JsonSerializerSettings();
            settings.DefaultValueHandling = DefaultValueHandling.Ignore;
            return JsonConvert.SerializeObject(o, Formatting.None, settings);
        }

        #endregion
    }
}
